﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HomeWork1_1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("输入一个数");
                double num1 = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("输入一个运算符");
                string op = Console.ReadLine();
                Console.WriteLine("输入一个数");
                double num2 = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("结果为：");
                switch (op)
                {
                    case "+":
                        Console.WriteLine(Convert.ToString(num1 + num2));
                        break;
                    case "-":
                        Console.WriteLine(Convert.ToString(num1 - num2));
                        break;
                    case "*":
                        Console.WriteLine(Convert.ToString(num1 * num2));
                        break;
                    case "/":
                        Console.WriteLine(Convert.ToString(num1 / num2));
                        break;
                    default:
                        Console.WriteLine(@"输入“+”、“-”、“*”、“/”以内的运算符");
                        break;
                }
            }catch (FormatException)
            {
                Console.WriteLine("输入正确的数");
            }
        }
    }
}
